﻿@model PagedList.IPagedList<GPS.MODELS.EditUserViewModel>
@using PagedList.Mvc;
@using GPS.Helpers;

<link rel="stylesheet" type="text/css" href="~/Content/PagedList.css" />

@*@model IEnumerable<GPS.MODELS.EditUserViewModel>*@


@{
    ViewBag.Title = "Index";
}

<div class="container fdb-div-content fdb-div-corner-all">
    <h3 class="text-center fdb-title-search-form">Danh sách người dùng  @ViewBag.TenTTP</h3>
    <br />
    <label style="color:red">@TempData["tmpErrorDelete"]</label>
    <hr class="fdb-hr" />
    <div class="row">
        @using (Html.BeginForm("Index", "Account", FormMethod.Get))
        {
            <div class="list-group">
                <fieldset class="fs_body">
                    <legend class="head_title">Điều Kiện Tìm Kiếm</legend>
                    <div class="row">
                        <div class="col-md-2 control-label">
                            Tên đăng nhập:
                        </div>
                        <div class="col-md-4">
                            <input type="text" name="txtUserName" class="form-control" />
                        </div>

                        <div class="col-md-2 control-label">
                            Email:
                        </div>
                        <div class="col-md-4">
                            <input type="text" name="txtEmail" class="form-control" />
                        </div>
                    </div>

                    <div class="row margin-top-05">
                        <div class="col-md-2 control-label">
                            Họ và tên:
                        </div>
                        <div class="col-md-4">
                            <input type="text" name="txtHoTen" class="form-control" />
                        </div>
                    </div>

                    <div class="row margin-top-05 btn_search">
                        <button type="submit" class="btn btn-warning btn-sm">
                            <span class="glyphicon glyphicon-search"></span> Tìm kiếm
                        </button>
                        @Html.NoEncodeActionLink("<span class='glyphicon glyphicon-plus'></span> Thêm mới", "Thêm mới", "Register", "Account", null, htmlAttributes: new { @class = "btn btn-warning btn-sm" })
                    </div>
                </fieldset>
            </div>
        }
    </div>
    <div class="row">
        <fieldset class="fs_body">
            <legend class="head_title">Kết Quả Tìm Kiếm</legend>
            <div style="float: right;">
                <label id="lblMessageTotal" style="color:blue; font-weight:bold">Tổng Số Bản Ghi: @ViewBag.TotalRow</label>
            </div>
            <table class="table table-hover table-striped table-condensed">
                <tr>
                    <th>
                        STT
                    </th>
                    <th>
                        Tên đang nhập
                    </th>
                    <th>
                        Họ đệm
                    </th>
                    <th>
                        Tên
                    </th>
                    <th>
                        Email
                    </th>
                    <th>
                        Thao tác
                    </th>
                </tr>
                @{
                    Int16 icount = 1;
                    foreach (var item in Model)
                    {
                        <tr>
                            <td align="center">
                                @Html.Raw(icount.ToString())
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.UserName)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.FirstName)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.LastName)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Email)
                            </td>
                            <td align="center">
                                @Html.ActionLink("Sửa", "Edit", new { id = item.UserName }) |
                                @Html.ActionLink("Nhóm", "UserGroups", new { id = item.UserName }) |
                                @*@Html.ActionLink("Phân quyền", "UserPermissions", new { id = item.UserName }) |*@
                                @Html.ActionLink("Xóa", "Delete", new { id = item.UserName }) |
                                @Html.ActionLink("Phân quyền chức năng", "UserAddMenu", new { id = item.UserName }) |
                                @Html.ActionLink("Thiết lập mật khẩu", "ResetPassword", new { id = item.UserName }) |
                            </td>
                        </tr>
                        icount++;
                    }
                }
            </table>

            <div class="row margin-top-05">
                <div class="pagination-sm">
                    @*The current page and total number of pages are displayed.*@
                    @*Trang @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount*@

                    @*The paging buttons are displayed by the PagedListPager helper*@
                    @Html.PagedListPager(Model, page => Url.Action("Index", new { page }))
                </div>
            </div>
        </fieldset>
    </div>
